﻿using System;
using System.Web.Mvc.Html;
using ControleRepresentante.Common;
using Attribute = ControleRepresentante.Logic.Models.Attribute;

namespace WebSite.ViewModels.IndexViewModels
{
    public static class AttributeIndexColumns
    {
        public static Guid Nome = new Guid("B8F18E13-E9F5-4F1D-9650-B3A05BCFCE58");
        public static Guid Tipo = new Guid("F6FED4D3-80EF-4462-90E4-DBBB99652360");
    }

    public class AttributeIndexViewModel : IndexViewModel<Attribute>
    {
        public AttributeIndexViewModel()
            : base("Atributos")
        {
        }

        protected override void RegisterColumns(IndexColumnDefinitionsCollectionWrapper<Attribute> indexColumnDefinitionsCollectionWrapper)
        {
            indexColumnDefinitionsCollectionWrapper.Register(AttributeIndexColumns.Nome, (attribute, htmlHelper) => htmlHelper.ActionLink(attribute.Name, "Details", new { id = attribute.Id }));
            indexColumnDefinitionsCollectionWrapper.Register(AttributeIndexColumns.Tipo, attribute => attribute.Type.GetDescription());
        }
    }
}